package com.reny.szkj.ft_login.ui.login

import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import org.kodein.di.*
import org.kodein.di.android.x.AndroidLifecycleScope

const val LOGIN_MODULE_TAG = "LOGIN_MODULE_TAG"

val loginDIModule = DI.Module(LOGIN_MODULE_TAG) {

    bind<LoginViewModel>() with scoped<AppCompatActivity>(AndroidLifecycleScope).singleton {
        ViewModelProvider(this.context, LoginViewModelFactory(instance())).get(LoginViewModel::class.java)
    }

    bind<LoginRepository>() with scoped<AppCompatActivity>(AndroidLifecycleScope).singleton {
        LoginRepository(instance())
    }

}